package ex.tableapi;

import org.apache.flink.table.api.Table;

import static org.apache.flink.table.api.Expressions.$;

public class ExWhereOrFilter extends   ApiFrame {
    private String outName = "printOutTable";

    public static void main(String[] args) {
        ExWhereOrFilter demo = new ExWhereOrFilter();
        demo.getEnv();
        Table orders = demo.registerMysql("myorder", "orders");
        Table result = demo.exWhereOrFilter(orders);

        demo.registerConsole(demo.createPrintOutDDL(result.getResolvedSchema().toString()), demo.outName);
        result.executeInsert(demo.outName);
    }

    private Table exWhereOrFilter(Table orders) {
        Table result = orders.as("x", "y", "z", "t");
        Table result1 = result.select($("x"), $("y")).limit(2);
        return result;
    }

}
